//
//  CustomSegMent.m
//  AoJi
//
//  Created by MinwenYi on 15-2-28.
//  Copyright (c) 2015年 xuanheng. All rights reserved.
//

#import "CustomSegMent.h"
@interface CustomSegMent()
{


}
@end


@implementation CustomSegMent

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(id)initWithFrame:(CGRect)frame  items:(NSArray*)items
{
    self=[super initWithFrame:frame];
    for (int i=0; i<items.count; i++) {
        UILabel *tem=[[UILabel alloc]initWithFrame:CGRectMake(Mainwidth/items.count*i, 0, Mainwidth/items.count, frame.size.height)];
        [self addSubview:tem];
        tem.text=items[i];
        tem.textColor=[UIColor blackColor];
        if (i!=0&&i!=items.count-1) {
            UIView *yline=[[UILabel alloc]initWithFrame:CGRectMake(viewRight(tem), 3, 1, viewHeight(tem))];
            yline.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"fengjiexian-y.png"]];
            [self addSubview:yline];
        }
        
        UIGestureRecognizer *tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapItem:)];
        tem.userInteractionEnabled=YES;
        [tem addGestureRecognizer:tap];
        
    }
    self.backgroundColor=kheadBgcolor;
    return self;
}

-(void)tapItem:(UIGestureRecognizer*)tap
{

}
@end
